Repository navigation
perf(rendering): render each view at most once per frame - #1037
Merged
Merged
Conversation
✅ Deploy Preview for volview-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
PaulHax
force-pushed
the
render-frame-scheduler
branch
4 times, most recently
from
November 16, 2026 21:52
1399efa to
6bba109
Compare
PaulHax
marked this pull request as ready for review
November 16, 2026 22:27
PaulHax
force-pushed
the
render-frame-scheduler
branch
from
November 16, 2026 23:46
6bba109 to
d2954ce
Compare
Render requests from the app and from vtk.js now share one render per view per frame. The vtk interactor's own render calls become requests, and a request made while rendering is dropped. The render runs in a task after the frame, so queued input is handled before drawing. View size comes from one resize observer, and slice views fit the camera on the view's resize event.
PaulHax
force-pushed
the
render-frame-scheduler
branch
from
November 17, 2026 02:20
d2954ce to
c40867f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After #1034, a single change could still render a view several times before the next frame was shown. The app, vtk.js widgets, and the vtk interactor each asked for renders independently, and each one drew.
This change gives every view one render per frame:
enableRender: false, so vtk.js's ownrender()calls only emitRenderEvent, which the view turns into a render request. vtk-initiated renders join the app's requests instead of drawing immediately. Frames of vtk's interaction animation, during drags and wheel zoom, draw when vtk asks for them.batchAfterNextFrame, which renders in a task after the next animation frame. Chrome runs a frame after each discrete input event, so rendering inside therequestAnimationFramecallback drew once per key press on slow views; for example, each arrow key on the en face slab slider got its own projection render. Running the render in a task after the frame lets queued input coalesce first. Updates appear in the frame after the input, as with the previous next-task batching.VtkSliceViewfits the camera on the view's window resize event, so the render that follows already shows the fit.Not covered: during interaction, vtk's interactor animation loop still renders every frame even when nothing changed, for example in the tail after mouse wheel input.